/**
 * @author 史鑫鑫
 * @description 会议相关接口合集
 * @date 2021-03-06
 * @modefied 史鑫鑫
 */
import request from '@/utils/request'

/**
 * 获取该用户今日会议
 */
export function todayConferences () {
  return request({
    url: '/m/api/v3/conferences/user/Today/conferences',
    method: 'get'
  })
}

/**
 * 用户点击创建一个会议
 * @param {Object} createMeetingForm 创建会议表单
 */
export function createConference (createMeetingForm) {
  return request({
    url: '/m/api/v3/conferences/create',
    method: 'post',
    data: createMeetingForm
  })
}

/**
 * 获取用户会议列表
 * @param {Number} status 会议状态 1 未开始 2 进行中 3暂停 4取消 5结束
 * @param {Number} page 页码
 * @param {Number} size 大小
 */
export function conferencesList (status, page = 1, size = 6) {
  return request({
    url: '/m/api/v3/conferences/user/conferences/list',
    method: 'get',
    params: {
      status,
      page,
      size
    }
  })
}

/**
 * 获取会议成员信息
 * @param {String} cid 会议id
 */
export function conferencesMemberInfo (cid) {
  return request({
    url: '/m/api/v3/conferences/user/member/info',
    method: 'get',
    params: {
      cid
    }
  })
}

/**
 * 主持人开始会议
 * @param {String} cid 会议id
 */
export function startConference (cid) {
  return request({
    url: `/m/api/v3/conferences/user/start/${cid}`,
    method: 'post'
  })
}

/**
 * 获取会议信息
 * @param {Number} cid 会议id
 */
export function conferencesInfo (cid) {
  return request({
    url: '/m/api/v3/conferences/user/info',
    method: 'get',
    params: {
      cid
    }
  })
}

/**
 * 获取字幕
 * @param {String} cid 会议id
 */
export function getSubtitle (cid) {
  return request({
    url: '/m/api/v3/conferences/subtitle',
    method: 'get',
    params: {
      cid
    }
  })
}
/**
 * 查看会议相关文件
 * @param {String} cid 会议id
 */
export function imUserUploadPreview (cid) {
  return request({
    url: '/m/api/v3/conferences/user/file/preview',
    method: 'get',
    params: {
      cid
    }
  })
}

/**
 * 用户查询会议聊天记录
 * @param {String} cid 会议id
 */
export function queryChatRecord (cid) {
  return request({
    url: '/m/api/v3/conferences/user/chat/history',
    method: 'get',
    params: {
      cid
    }
  })
}
/**
 * 判断是否在黑名单中
 * @param {String} cid 会议号
 */
export function judgeBlackList (cid) {
  return request({
    url: '/m/api/v3/conferences/judge/blackList',
    method: 'get',
    params: {
      cid
    }
  })
}

/**
 * 判断会议是否私密
 * @param {String} meetingNumber 会议号
 */
export function judgePrivate (meetingNumber) {
  return request({
    url: '/m/api/v3/conferences/judge/private',
    method: 'get',
    params: {
      meetingNumber
    }
  })
}

/**
 * 单个用户加入会议
 * @param {String} cid 会议id
 * @param {String} password 会议密码
 */
export function singleJoinMeeting (cid, password) {
  return request({
    url: `/m/api/v3/conferences/join/${cid}`,
    method: 'post',
    data: {
      password
    }
  })
}

/**
 * 存储网络数据
 * @param {Array} networkDataList 会议数据数组
 */
export function storeNetworkData (networkDataList) {
  return request({
    url: '/m/api/v3/conferences/user/network/data',
    method: 'post',
    data: networkDataList
  })
}

/**
 * 主持人结束会议
 * @param {String} cid 会议id
 */
export function finishConference (cid) {
  return request({
    url: `/m/api/v3/conferences/user/finish/${cid}`,
    method: 'post'
  })
}

/**
 * 用户点击取消一个会议
 * @param {String} cid 会议id
 */
export function cancelConference (cid) {
  return request({
    url: `/m/api/v3/conferences/user/cancel/${cid}`,
    method: 'post'
  })
}

/**
 * 用户点击删除一个会议
 * @param {String} cid 会议id
 */
export function dismissConferences (cid) {
  return request({
    url: `/m/api/v3/conferences/user/dismiss/conference/${cid}`,
    method: 'put'
  })
}
